<template>
  <div>
    <el-button type="primary" @click="dialogTableVisible = true">添加</el-button>
    <el-dialog v-el-drag-dialog title="添加" :visible.sync="dialogTableVisible">
      <el-form  ref="row_data" label-position="left" label-width="70px" style='width: 400px; margin-left:50px;'>
                <el-form-item label="id'" prop="id">
          <el-input placeholder="id" v-model="row_data.id"></el-input>
        </el-form-item>
                <el-form-item label="标题'" prop="title">
          <el-input placeholder="标题" v-model="row_data.title"></el-input>
        </el-form-item>
                <el-form-item label="内容'" prop="content">
          <el-input placeholder="内容" v-model="row_data.content"></el-input>
        </el-form-item>
                <el-form-item label="创建时间'" prop="create_time">
          <el-input placeholder="创建时间" v-model="row_data.create_time"></el-input>
        </el-form-item>
                <el-form-item label="过期时间'" prop="over_time">
          <el-input placeholder="过期时间" v-model="row_data.over_time"></el-input>
        </el-form-item>
                <el-form-item label="状态'" prop="status">
          <el-input placeholder="状态" v-model="row_data.status"></el-input>
        </el-form-item>
                <el-form-item label="活动时间'" prop="time">
          <el-input placeholder="活动时间" v-model="row_data.time"></el-input>
        </el-form-item>
                <el-form-item label="活动地点'" prop="address">
          <el-input placeholder="活动地点" v-model="row_data.address"></el-input>
        </el-form-item>
                <el-form-item>
          <el-button type="primary" @click="submitForm()">立即创建</el-button>
          <el-button @click="close()">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
  import elDragDialog from '@/directive/el-dragDialog' // base on element-ui
  import { add } from '@/api/activity/activity'
  import store from '@/store'
  export default {
    name: 'dragDialog-demo',
    directives: { elDragDialog },
    data() {
      return {
        dialogTableVisible: false,
        row_data: {
        }
      }
    },
    methods: {
      submitForm() {
        add(store.getters.token, this.row_data).then(res => {
          this.$emit('getLists')
          this.close()
        })
      },
      close() {
        this.dialogTableVisible = false
      }
    }
  }
</script>
